<template>
  <footer class="footer">
    <span class="todo-count"
      >总计：<strong>{{ list.length }}</strong></span
    >
    <ul class="filters">
      <li @click="changeState('all')">
        <a :class="{ selected: state === 'all' }" href="javascript:;">全部</a>
      </li>
      <li @click="changeState('notdone')">
        <a :class="{ selected: state === 'notdone' }" href="javascript:;"
          >未完成</a
        >
      </li>
      <li @click="changeState('done')">
        <a :class="{ selected: state === 'done' }" href="javascript:;"
          >已完成</a
        >
      </li>
    </ul>
    <button @click="delDone" class="clear-completed">清除已完成</button>
  </footer>
</template>

<script>
export default {
  props: {
    list: {
      type: Array,
      default: () => [],
    },
    state: {
      type: String,
      default: "all",
    },
  },
  methods: {
    changeState(state) {
      this.$emit("change-state", state);
    },
    delDone(){
      this.$emit('del-done',)
    }
  },
};
</script>